package pcb.views.library 
{
	import com.intel.utils.Debugger;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	import pcb.views.uievents.SlideEvent;
	
	/**
	 * ...
	 * @author ...
	 */
	public class ShowMe extends MovieClip 
	{
		//.5 sec delay on complete
		var delay:Number = 500;
		
		public function ShowMe() 
		{
			this.visible = false;
		}
		
		public function execute():void {
			this.visible = true;
			this.play();
		}
		
		public override function stop():void {
			if (this.currentFrame == this.totalFrames) {
				var timer:Timer = new Timer(delay,1);
				timer.addEventListener(TimerEvent.TIMER_COMPLETE, t_onComplete);				
				timer.start();
				
			}
			super.stop();
		}
		
		private function t_onComplete(e:TimerEvent):void 
		{
			e.target.removeEventListener(TimerEvent.TIMER_COMPLETE, t_onComplete);
			dispatchEvent(new Event(SlideEvent.INTERACTIVITY_COMPLETED, true));
		}
		
	}
	
}